﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Finance_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int year = string.IsNullOrEmpty(Request.QueryString["year"]) ?
                DateTime.Now.Year : int.Parse(Request.QueryString["year"]);
            this.txtYear.Text = year.ToString();
            BindYearReportData(year);
        }
    }

    protected void txtYear_TextChanged(object sender, EventArgs e)
    {
        int year = int.Parse(this.txtYear.Text);
        Response.Redirect(string.Format("~/Finance/Default.aspx?year={0}", year), true);
    }

    private void BindYearReportData(int year)
    {
        this.rptYearReport.DataSource = Active.Core.FinanceManager.GetYearReport(year);
        this.rptYearReport.DataBind();
    }
}
